import { RefundAuditList } from "../../api/refundaudit"
import {useStore} from "vuex";
export function useRefundAuditList(){
	const {state} = useStore()
	function initRefundAuditList(params:any){
		 return new Promise((resolve, reject)=>{
				RefundAuditList({
					OPERATOR_ID: state.user.userInfo.CUSER_ID,
					CLASSNAME:params?.ClassName || "",
					STUDENTNAME:params?.StudentName|| "",
					PAGEINDEX:params?.Page || "1",
					PAGESIZE: params?.PageSize || "10",
					SH_FLAG:params?.SH_FLAG || "0"
				}).then(res=>{
					if (res.ERROR[0].errcode == '0'){
					    resolve(res)
					}else {
					    uni.showToast({
					        title: res.ERROR[0].error,
					        icon: 'none',
					        mask: true
					    })
					    reject('err')
					}
				})
				.catch(err=>{
					uni.showToast({
					    title: '获取列表失败',
					    icon: 'error',
					    mask: true
					})
					reject('err')
				})
		 }) 
	 }
	return {
		initRefundAuditList
	}
}